#import <appkit/appkit.h>

#define SimpleSubClass(CLASS, SUBCLASS)                                  \
                                                                         \
    @interface SUBCLASS:CLASS   {   @public int     x;      }   @end     \
    @implementation SUBCLASS                                             \
            - init                                                       \
            {                                                            \
                self = [super  init];   x = 100;    return self;         \
            }                                                            \
    @end

#define PrintOut(SUBCLASS)                                               \
            {                                                            \
                SUBCLASS    *b, *a = [[SUBCLASS  alloc]  init];          \
                                                                         \
                b = [a  copy];                                           \
                printf("%17s = %d\tCopy = %d\n", [a  name], a->x, b->x); \
            }

SimpleSubClass(List, List_x)
SimpleSubClass(Storage, Storage_x)
SimpleSubClass(Object, Object_x)
SimpleSubClass(View, View_x)
SimpleSubClass(Control, Control_x)
SimpleSubClass(HashTable, HashTable_x)
SimpleSubClass(NXBundle, NXBundle_x)
SimpleSubClass(Cell, Cell_x)
SimpleSubClass(NXData, NXData_x)
SimpleSubClass(NXStringTable, NXStringTable_x)
SimpleSubClass(ButtonCell, ButtonCell_x)

int main(int argc,char argv[]){
  printf("%s\n","TEST: All values should equal 100");

  PrintOut(List_x);
  PrintOut(Object_x);
  PrintOut(Storage_x)
  PrintOut(View_x)
  PrintOut(Control_x)
  PrintOut(HashTable_x)
  PrintOut(NXBundle_x)
  PrintOut(Cell_x)
  PrintOut(NXData_x)
  PrintOut(NXStringTable_x)
  PrintOut(ButtonCell_x)

  printf("\n");
  exit(0);
  }
